<template>
  <div>
    <el-dialog title="批量导入蜂窝信息" :visible="visible" width="30%" @close="onClose">
      <el-form :model="formValue" :rules="formRules" ref="formRef">
        <el-form-item label="顶级渠道" :label-width="formLabelWidth" prop="topChannelCode">
          <el-select v-model="formValue.topChannelCode" placeholder="请选择" style="width: 70%" clearable>
            <el-option v-for="item in topChannelList" :key="item.id" :label="item.name" :value="item.id" />
          </el-select>
        </el-form-item>
        <el-form-item label="请选择" :label-width="formLabelWidth" prop="cellularList">
          <el-upload
            ref="upload"
            class="upload-demo"
            action="https://jsonplaceholder.typicode.com/posts/"
            :limit="1"
            :auto-upload="false"
            :on-change="onChange"
            :on-error="onError"
            accept=".xlsx"
          >
            <div>
              <el-button size="small">点击上传</el-button>
            </div>
          </el-upload>
        </el-form-item>
        <el-form-item :label-width="formLabelWidth">
          <div :class="$style.downTemplate">
            <a style="margin-right: 30px" @click="downImportTemplate()">批量导入蜂窝信息模板下载</a>
          </div>
        </el-form-item>
      </el-form>
      <div slot="footer" style="text-align: center">
        <el-button @click="onSubmit('formRef')" type="primary">导入</el-button>
        <el-button @click="onClose">取消</el-button>
      </div>
    </el-dialog>
    <el-dialog
      title="提示"
      :visible="resultVisible"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      width="500px"
      @close="onCloseResultModal"
    >
      <ul :class="$style.list">
        <li :class="$style.listItem" v-for="item in tipData" :key="item.rowNo" :style="{ color: 'rgb(255,0,0)' }">
          第<span :class="$style.rowIndex">{{ item.rowNo }}</span
          >行数据已忽略 - <span :class="$style.reason">{{ item.errorMsg }}</span>
        </li>
      </ul>
    </el-dialog>
  </div>
</template>

<style lang="scss" module>
@import './index.module.scss';
</style>

<script>
import Index from './index';
export default Index;
</script>
